﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        $("#Class").bindSelect({
            url: "/SystemManage/ItemsData/GetSelectJson",
            param: { enCode: "Class" }
        });
        $("#TransactorRelation").bindSelect({
            url: "/SystemManage/ItemsData/GetSelectJson",
            param: { enCode: "TransactorRelationItem" }
        });
        $("#InSchoolName").bindSelect({
            url: "/Gas/School/GetSchoolSelectJson",
        });

        $('#RollOutDate').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });

        if (null != keyValue && "" != keyValue) {
            $.ajax({
                url: "/Gas/RollOutRecord/GetFormJsonForUpdate",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    initPicDiv(data);
                }
            });
        }
    });
    //更新或者详情页的图片初始化
    function initPicDiv(data) {
        if ('undefined' != data.Pic_RollOutHouseHoldIndex || null != data.Pic_RollOutHouseHoldIndex || "" != data.Pic_RollOutHouseHoldIndex) {
            updatePicDiv("RollOutHouseHoldIndex", data.Pic_RollOutHouseHoldIndex);
        }
        if ('undefined' != data.Pic_RollOutHouseHoldStudent || null != data.Pic_RollOutHouseHoldStudent || "" != data.Pic_RollOutHouseHoldStudent) {
            updatePicDiv("RollOutHouseHoldStudent", data.Pic_RollOutHouseHoldStudent);
        }
        if ('undefined' != data.Pic_TransactorIDNumber || null != data.Pic_TransactorIDNumber || "" != data.Pic_TransactorIDNumber) {
            updatePicDiv("TransactorIDNumber", data.Pic_TransactorIDNumber);
        }
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/Gas/RollOutRecord/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
<style>
    .titileWidth {
        width: 250px !important;
    }
</style>
<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle titileWidth">学生姓名</th>
                <td class="formValue">
                    <input id="studentName" name="studentName" type="text" class="form-control required" placeholder="请输入学生姓名" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">学生身份证号</th>
                <td class="formValue">
                    <input id="IDNumber" name="IDNumber" type="text" class="form-control required" placeholder="请输入学生身份证号" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">年级</th>
                <td class="formValue">
                    <select id="Class" name="Class" style="height:20px" class="form-control required"></select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">转入学校名称</th>
                <td class="formValue">
                    <select id="InSchoolName" name="InSchoolName" style="height:20px" class="form-control"></select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">办理人姓名</th>
                <td class="formValue">
                    <input id="TransactorName" name="TransactorName" type="text" class="form-control required" placeholder="请输入办理人姓名" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">办理人与学生关系</th>
                <td class="formValue">
                    <select id="TransactorRelation" name="TransactorRelation" style="height:20px" class="form-control required"></select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">学生转出离校时间</th>
                <td class="formValue">
                    <input type="text" value="" id="RollOutDate" class="form-control" data-date-format="yyyy年mm月dd日" style="width: 150px;">
                </td>
            </tr>
            <tr>
                <th class="formTitle">户口本索引页照片(jpg格式)<br>（选择照片后要点击上传，不超过1M）</th>
                <td>
                    <div><input type="file" name="Pic_RollOutHouseHoldIndex_File" id="Pic_RollOutHouseHoldIndex_File" /></div>
                    <div><input type="button" id="upRollOutHouseHoldIndexPic" style="height:22.8px; font-size:10px;" value="上传" onclick="uploadPic('RollOutHouseHoldIndex')" /></div>
                    <div><input type="hidden" name="Pic_RollOutHouseHoldIndex" id="Pic_RollOutHouseHoldIndex" value="" /></div>
                    <div id="RollOutHouseHoldIndexPic"></div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">户口本学生本人页照片(jpg格式)<br>（选择照片后要点击上传，不超过1M）</th>
                <td>
                    <div><input type="file" name="Pic_RollOutHouseHoldStudent_File" id="Pic_RollOutHouseHoldStudent_File" /></div>
                    <div><input type="button" id="upRollOutHouseHoldStudentPic" style="height:22.8px; font-size:10px;" value="上传" onclick="uploadPic('RollOutHouseHoldStudent')" /></div>
                    <div><input type="hidden" name="Pic_RollOutHouseHoldStudent" id="Pic_RollOutHouseHoldStudent" value="" /></div>
                    <div id="RollOutHouseHoldStudentPic"></div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">办理人身份证照片(jpg格式)<br>（选择照片后要点击上传，不超过1M）</th>
                <td>
                    <div><input type="file" name="Pic_TransactorIDNumber_File" id="Pic_TransactorIDNumber_File" /></div>
                    <div><input type="button" id="upTransactorIDNumberPic" style="height:22.8px; font-size:10px;" value="上传" onclick="uploadPic('TransactorIDNumber')" /></div>
                    <div><input type="hidden" name="Pic_TransactorIDNumber" id="Pic_TransactorIDNumber" value="" /></div>
                    <div id="TransactorIDNumberPic"></div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">备注</th>
                <td class="formValue">
                    <input id="Content" name="Content" type="text" class="form-control" placeholder="备注" />
                </td>
            </tr>
        </table>
    </div>
</form>
<div id="outerdiv" style="position:fixed;top:0;left:200px;background:rgba(0,0,0,0.7);z-index:2000;display:none;">
    <div id="innerdiv" style="position:absolute;width: 200%;height:200%;">
        <img id="bigimg" style="border:5px solid #fff;width: 800px;height:600px;" src="" />
    </div>
</div>